package com.dorso.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dorso.dao.SupplierDao;
import com.dorso.entity.Supplier;
import com.dorso.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SupplierServiceImpl extends ServiceImpl<SupplierDao, Supplier> implements SupplierService {
    @Autowired
    SupplierDao supplierDao;
    @Override
    public IPage<Supplier> findSuppliers(String name, Integer pageNum, Integer pageSize) {
        Page<Supplier> page=new Page<>(pageNum,pageSize);
        QueryWrapper<Supplier> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("name",name);
        supplierDao.selectPage(page,queryWrapper);
        return page;
    }
}
